<!--
Copyright (c) 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <title>{{.Meta.Title}}</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400|Roboto:400,300,400italic,500,700|Roboto+Mono">
  <link rel="stylesheet" href="{{.Prefix}}styles/codelab.css">
  <style>
    html {
        height: 100%;
        margin: 0;
        padding: 0;
    }
  </style>
</head>

<body class="codelab-takeover">
  <div class="codelab__toc">{{range $i, $t := .Steps}}
    <a href="{{inc $i | stepLink}}" class="{{inc $i | tocItemClass $.StepNum}}">
      <span class="toc-item__index">{{inc $i}}</span>
      <span class="toc-item__title">{{$t.Title}}</span>
    </a>{{end}}
  </div>

  <div class="codelab__step">

    <div class="step__header">
      <a href="{{dec .StepNum | stepLink}}"{{if not .Prev}} class="invis"{{end}}>
        <svg fill="#FFFFFF" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
          <path d="M0 0h24v24H0z" fill="none"/>
          <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
        </svg>
      </a>

      <a href="{{.Prefix}}index.html" title="Return to home page">
        <svg fill="#FFFFFF" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
          <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
          <path d="M0 0h24v24H0z" fill="none"/>
        </svg>
      </a>

      <a href="{{inc .StepNum | stepLink}}"{{if not .Next}} class="invis"{{end}}>
        <svg fill="#FFFFFF" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
          <path d="M0 0h24v24H0z" fill="none"/>
          <path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/>
        </svg>
      </a>

      <h1>{{.Meta.Title}}</h1>
    </div>

    <div class="step__body">
      <h1>{{.Meta.Title}}</h1>
      <h2>{{.StepNum}}. {{.Current.Title}}</h2>
      {{.Current.Content | renderLite $.Context}}
    </div>

  </div><!-- codelab__toc -->

  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    {{if .GlobalGA}}ga('create', '{{.GlobalGA}}', 'auto');{{end}}

    (function() {
      var gaCodelab = '{{.Meta.GA}}';
      if (gaCodelab) {
        ga('create', gaCodelab, 'auto', {name: 'codelab'});
      }

      var gaView;
      var parts = location.search.substring(1).split('&');
      for (var i = 0; i < parts.length; i++) {
        var param = parts[i].split('=');
        if (param[0] === 'viewga') {
          gaView = param[1];
          break;
        }
      }
      if (gaView && gaView !== gaCodelab) {
        ga('create', gaView, 'auto', {name: 'view'});
      }
    })();
  </script>
  <script src="{{.Prefix}}scripts/codelab.js" async></script>
</body>
</html>
